<?php




namespace App\Http\Controllers\Api\Dynamic;


use App\Http\Controllers\Api\BasicController;
use App\Http\Controllers\Api\User\MarketLevel;
use App\Models\Dynamic\Report;
use App\Models\Dynamic\Review;
use App\Models\Dynamic\Tag;
use GatewayWorker\Lib\Gateway;
use Jiannei\Response\Laravel\Support\Facades\Response;
use Str;

class ReviewController extends BasicController
{


    /**
     * @api {post} /dynamic/review/add  添加评论
     * @apiHeader {String} Authorization='Bearer '
     */
    public function add()
    {
        $data = $this->data(['dynamic_id','review_id','content','image']);
        $data['user_id'] = $this->uid();
        $result = Review::create($data);
        return Response::success($result);
    }

    public function list(){

        $dynamic_id=$this->request->input('dynamic_id');
        $result=(new Review())->getList($dynamic_id,$this->uid());
        return Response::success($result);

    }

    /**
     * @api {post} /dynamic/review/del  删除
     * @apiHeader {String} Authorization='Bearer '
     */
    public function del()
    {
        $where=['id'=>$this->request->input('id'),'user_id'=>$this->uid()];
        $result = Review::where($where)->delete();
        return Response::success($result);
    }

}
